const redis = require('redis');
const dao_game = require('./dao_game');

const redisClient = redis.createClient({
    url: 'redis://localhost:6379' // 根据实际情况修改
});

// 错误处理
redisClient.on('error', (err) => console.error('Redis 错误:', err));

// 连接 Redis 并处理异步
async function connectRedis() {
    try {
        await redisClient.connect();
    } catch (err) {
        console.error('Redis 连接失败:', err);
    }
}

// 调用连接函数
connectRedis();

module.exports = redisClient;
